﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Web;
using System.Web.Mvc;
using XT.BusinessService;
using XT.Model;
using XT.Web.External;

namespace XT.Web.Controllers
{
    public class HostController : Controller
    {
        //
        // GET: /Host/

        public ActionResult Index(int Id)
        {
            var accountService = MvcApplication.GetInstance<IAccountService>();
            Account account = (Account)accountService.getAccountById(Id);

            return View(account);
        }
        public ActionResult About(int Id)
        {
            var accountService = MvcApplication.GetInstance<IAccountService>();
            Account account = (Account)accountService.getAccountById(Id);

            return View(account);
        }

        public ActionResult RoomList(int Id)
        {
            var accountService = MvcApplication.GetInstance<IAccountService>();
            Account account = (Account)accountService.getAccountById(Id);

            return View(account);
        }
        public ActionResult Rooms(int Id)
        {
            var roomlistService = MvcApplication.GetInstance<IRoomListService>();
            //Account account = (Account)accountService.getAccountById(Id);
            Room_List roomlist = (Room_List)roomlistService.getRoomListById(Id);
            return View(roomlist);
        }

        public ActionResult EditView(int Id,int flag)
        {
             var accountService = MvcApplication.GetInstance<IAccountService>();
            Account account = (Account)accountService.getAccountById(Id);
            if (flag == 0)
                return Json(new { content = Helper.RenderViewToString(this.ControllerContext, "About/AboutDetailEdit", account) });
            else
                return Json(new { content = Helper.RenderViewToString(this.ControllerContext, "About/AboutDetail", account) });
        }
    }
}
